<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Class: JobBoss::Config</title>

	<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />

	<script src="../js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="class">

	<div id="metadata">
		<div id="home-metadata">
			<div id="home-section" class="section">
        <h3 class="section-header">
          <a href="../index.html">Home</a>
          <a href="../index.html#classes">Classes</a>
          <a href="../index.html#methods">Methods</a>
        </h3>
			</div>
		</div>

		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="../lib/job_boss/config_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="lib/job_boss/config.rb">lib/job_boss/config.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			
			<div id="parent-class-section" class="section">
				<h3 class="section-header">Parent</h3>
				
				<p class="link">Object</p>
				
			</div>
			

			<!-- Namespace Contents -->
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#method-i-parse_args">#parse_args</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
		</div>

		<div id="project-metadata">
			
			
			<div id="fileindex-section" class="section project-section">
				<h3 class="section-header">Files</h3>
				<ul>
				
					<li class="file"><a href="../Gemfile.html">Gemfile</a></li>
				
					<li class="file"><a href="../MIT-LICENSE.html">MIT-LICENSE</a></li>
				
					<li class="file"><a href="../Rakefile.html">Rakefile</a></li>
				
				</ul>
			</div>
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="../images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="../JobBoss.html">JobBoss</a></li>
				
					<li><a href="../JobBoss/Boss.html">JobBoss::Boss</a></li>
				
					<li><a href="../JobBoss/Config.html">JobBoss::Config</a></li>
				
					<li><a href="../JobBoss/Job.html">JobBoss::Job</a></li>
				
					<li><a href="../JobBoss/Queuer.html">JobBoss::Queuer</a></li>
				
					<li><a href="../ActiveSupport.html">ActiveSupport</a></li>
				
					<li><a href="../ActiveSupport/TestCase.html">ActiveSupport::TestCase</a></li>
				
					<li><a href="../CreateJobs.html">CreateJobs</a></li>
				
					<li><a href="../DaemonTest.html">DaemonTest</a></li>
				
					<li><a href="../MathJobs.html">MathJobs</a></li>
				
					<li><a href="../Penguin.html">Penguin</a></li>
				
					<li><a href="../SleepJobs.html">SleepJobs</a></li>
				
					<li><a href="../StringJobs.html">StringJobs</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="class">JobBoss::Config</h1>

		<div id="description">
			
		</div>

		<!-- Constants -->
		

		<!-- Attributes -->
		
		<div id="attribute-method-details" class="method-section section">
			<h3 class="section-header">Attributes</h3>

			
			<div id="application-root-attribute-method" class="method-detail">
				<a name="application_root"></a>
				
				<a name="application_root="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">application_root</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="database-yaml-path-attribute-method" class="method-detail">
				<a name="database_yaml_path"></a>
				
				<a name="database_yaml_path="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">database_yaml_path</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="log-path-attribute-method" class="method-detail">
				<a name="log_path"></a>
				
				<a name="log_path="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">log_path</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="jobs-path-attribute-method" class="method-detail">
				<a name="jobs_path"></a>
				
				<a name="jobs_path="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">jobs_path</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="sleep-interval-attribute-method" class="method-detail">
				<a name="sleep_interval"></a>
				
				<a name="sleep_interval="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">sleep_interval</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="employee-limit-attribute-method" class="method-detail">
				<a name="employee_limit"></a>
				
				<a name="employee_limit="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">employee_limit</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="environment-attribute-method" class="method-detail">
				<a name="environment"></a>
				
				<a name="environment="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">environment</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
		</div>
		

		<!-- Methods -->
		
		<div id="public-instance-method-details" class="method-section section">
			<h3 class="section-header">Public Instance Methods</h3>

		
			<div id="parse-args-method" class="method-detail ">
				<a name="method-i-parse_args"></a>

				<div class="method-heading">
				
					<span class="method-name">parse_args</span><span
						class="method-args">(argv, options = {})</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="parse-args-source">
<pre>
    <span class="ruby-comment cmt"># File lib/job_boss/config.rb, line 7</span>
 7:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_args</span>(<span class="ruby-identifier">argv</span>, <span class="ruby-identifier">options</span> = {})
 8:       <span class="ruby-ivar">@application_root</span>     = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_APPLICATION_ROOT'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:working_dir</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>)
 9:       <span class="ruby-ivar">@database_yaml_path</span>   = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_DATABASE_YAML_PATH'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'config/database.yml'</span>
10:       <span class="ruby-ivar">@log_path</span>             = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_LOG_PATH'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'log/job_boss.log'</span>
11:       <span class="ruby-ivar">@jobs_path</span>            = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_JOBS_PATH'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'app/jobs'</span>
12:       <span class="ruby-ivar">@sleep_interval</span>       = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_SLEEP_INTERVAL'</span>].<span class="ruby-identifier">blank?</span> <span class="ruby-operator">?</span> <span class="ruby-value">0.5</span> <span class="ruby-operator">:</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_SLEEP_INTERVAL'</span>].<span class="ruby-identifier">to_f</span>
13:       <span class="ruby-ivar">@employee_limit</span>       = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_EMPLOYEE_LIMIT'</span>].<span class="ruby-identifier">blank?</span> <span class="ruby-operator">?</span> <span class="ruby-value">4</span> <span class="ruby-operator">:</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_EMPLOYEE_LIMIT'</span>].<span class="ruby-identifier">to_i</span>
14:       <span class="ruby-ivar">@environment</span>          = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'JB_ENVIRONMENT'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'development'</span>
15: 
16:       <span class="ruby-identifier">require</span> <span class="ruby-value str">'optparse'</span>
17: 
18:       <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
19:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-value str">&quot;Usage: job_boss [start|stop|restart|run|zap] [-- &lt;options&gt;]&quot;</span>
20: 
21:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-r&quot;</span>, <span class="ruby-value str">&quot;--application-root PATH&quot;</span>, <span class="ruby-value str">&quot;Path for the application root upon which other paths depend (defaults to .)  Environment variable: JB_APPLICATION_ROOT&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
22:           <span class="ruby-ivar">@application_root</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
23:         <span class="ruby-keyword kw">end</span>
24: 
25:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-d&quot;</span>, <span class="ruby-value str">&quot;--database-yaml PATH&quot;</span>, <span class="ruby-node">&quot;Path for database YAML (defaults to &lt;application-root&gt;/#{@database_yaml_path}) Environment variable: JB_DATABASE_YAML_PATH&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
26:           <span class="ruby-ivar">@database_yaml_path</span> = <span class="ruby-identifier">path</span>
27:         <span class="ruby-keyword kw">end</span>
28: 
29:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-l&quot;</span>, <span class="ruby-value str">&quot;--log-path PATH&quot;</span>, <span class="ruby-node">&quot;Path for log file (defaults to &lt;application-root&gt;/#{@log_path}) Environment variable: JB_LOG_PATH&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
30:           <span class="ruby-ivar">@log_path</span> = <span class="ruby-identifier">path</span>
31:         <span class="ruby-keyword kw">end</span>
32: 
33:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-j&quot;</span>, <span class="ruby-value str">&quot;--jobs-path PATH&quot;</span>, <span class="ruby-node">&quot;Path to folder with job classes (defaults to &lt;application-root&gt;/#{@jobs_path}) Environment variable: JB_JOBS_PATH&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
34:           <span class="ruby-ivar">@jobs_path</span> = <span class="ruby-identifier">path</span>
35:         <span class="ruby-keyword kw">end</span>
36: 
37:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-e&quot;</span>, <span class="ruby-value str">&quot;--environment ENV&quot;</span>, <span class="ruby-node">&quot;Environment to use in database YAML file (defaults to '#{@environment}') Environment variable: JB_ENVIRONMENT&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
38:           <span class="ruby-ivar">@environment</span> = <span class="ruby-identifier">env</span>
39:         <span class="ruby-keyword kw">end</span>
40: 
41:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-s&quot;</span>, <span class="ruby-value str">&quot;--sleep-interval INTERVAL&quot;</span>, <span class="ruby-constant">Integer</span>, <span class="ruby-node">&quot;Number of seconds for the boss to sleep between checks of the queue (default #{@sleep_interval}) Environment variable: JB_SLEEP_INTERVAL&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">interval</span><span class="ruby-operator">|</span>
42:           <span class="ruby-ivar">@sleep_interval</span> = <span class="ruby-identifier">interval</span>
43:         <span class="ruby-keyword kw">end</span>
44: 
45:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-c&quot;</span>, <span class="ruby-value str">&quot;--employee-limit LIMIT&quot;</span>, <span class="ruby-constant">Integer</span>, <span class="ruby-value str">&quot;Maximum number of employees (default 4) Environment variable: JB_EMPLOYEE_LIMIT&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">limit</span><span class="ruby-operator">|</span>
46:           <span class="ruby-ivar">@employee_limit</span> = <span class="ruby-identifier">limit</span>
47:         <span class="ruby-keyword kw">end</span>
48:       <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">argv</span>)
49:     <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

